﻿using System.IO;
using NBuild.Fx;
using NBuild.Fx.Interfaces;

namespace NBuild.Tasks
{
    public class FileSystemTasks : TaskSet
    {
        public FileSystemTasks(IBuildEngine engine, IBuildScript script) :
            base(engine, script)
        {
        }

        public void Delete(FileTaskItems fileItems)
        {
            foreach (FileInfo fileItem in fileItems)
                if (File.Exists(fileItem.FullName))
                    File.Delete(fileItem.FullName);
        }

        public void DisplayFiles(FileTaskItems fileItems)
        {
            foreach (var fileItem in fileItems)
                Log(LogType.Info, fileItem);
        }

        public sealed class CopyOptions
        {
            private readonly FileTaskItems _sources = new FileTaskItems();

            public string Destination { get; set; }

            public FileTaskItems Sources
            {
                get { return _sources; }
            }
        }
    }
}
